<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>不为人知的小小世界</title>
    <link rel="stylesheet" href="/static/css/output.css">
    <style>
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes glow {
            0%, 100% {
                text-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
            }
            50% {
                text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
            }
        }

        .animate-fadeInUp {
            animation: fadeInUp 1s ease-in-out;
            animation-fill-mode: backwards;
        }

        .animate-glow {
            animation: glow 2s ease-in-out infinite;
        }

        .bg-custom {
            background-image: url('https://objectstorageapi.bja.sealos.run/g6rnmc1y-yunshang/wan_ip/123.jpg');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            background-attachment: fixed;
            filter: brightness(0.7); /* 降低背景图片亮度 */
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .container {
                padding: 20px;
            }
            .text-5xl {
                font-size: 2.5rem !important;
            }
            .text-2xl {
                font-size: 1.25rem !important;
            }
            .text-xl {
                font-size: 1rem !important;
            }
            .text-lg {
                font-size: 0.9rem !important;
            }
        }

        /* 亲密性原则：减少文本间距 */
        .content {
            max-width: 600px; /* 限制最大宽度 */
            margin-left: 50px; /* 与左侧保持一定距离 */
        }

        .content h1, .content h2, .content h3, .content p, .content ul {
            margin-bottom: 1rem; /* 减少段间距 */
        }

        .content ul {
            padding-left: 1rem; /* 减少列表缩进 */
        }

        .content p {
            line-height: 1.4; /* 减少行间距 */
        }
    </style>
</head>

<body class="min-h-screen text-white relative">
    <!-- 背景图片层 -->
    <div class="fixed inset-0 -z-20">
        <div class="absolute inset-0 bg-[url('https://objectstorageapi.bja.sealos.run/g6rnmc1y-yunshang/wan_ip/123.jpg')] bg-cover bg-center bg-no-repeat bg-fixed"></div>
        <div class="absolute inset-0 bg-black/50"></div>
    </div>

    <!-- 导航栏 -->
    <nav class="fixed top-0 left-0 w-full bg-black/50 backdrop-blur-sm z-50">
        <div class="container mx-auto h-16 flex items-center justify-between px-5">
            <div class="flex items-center space-x-4">
                <span class="text-xl font-bold animate-glow">SERVER</span>
                <div id="modification-date" class="text-sm text-gray-300"></div>
            </div>
            <div id="time-container" class="text-gray-300">
                <span id="time" class="text-xl"></span>
                <span id="greeting" class="ml-2 text-xl"></span>
            </div>
        </div>
    </nav>

    <!-- 主要内容 -->
    <div class="flex flex-col justify-center min-h-screen">
        <!-- 左侧内容区 -->
        <div class="ml-[150px] md:ml-[50px] lg:ml-[150px] mt-[70px] max-w-2xl">
            <h1 id="welcome" class="text-4xl lg:text-5xl mb-4 font-bold animate-fadeInUp animate-glow" style="animation-delay: 0.5s;">
                欢迎来到服务器的发布页。
            </h1>
            <h2 id="description" class="text-xl lg:text-2xl mb-8 animate-fadeInUp" style="animation-delay: 0.7s;">
                我们将会在这里发布服务器的ip地址
            </h2>
            
            <div class="bg-black/20 backdrop-blur-sm rounded-lg p-6 border border-white/10">
                <h3 class="text-xl mb-4 font-semibold animate-fadeInUp" style="animation-delay: 0.9s;">IPv4 地址</h3>
                <ul id="ipv4-list" class="list-none space-y-2 mb-6 animate-fadeInUp" style="animation-delay: 1s;">
                    <!-- IP列表项会通过JS动态添加 -->
                </ul>
                
                <h3 class="text-xl mb-4 font-semibold animate-fadeInUp" style="animation-delay: 1.1s;">IPv6 地址</h3>
                <ul id="ipv6-list" class="list-none space-y-2 mb-6 animate-fadeInUp" style="animation-delay: 1.2s;">
                    <!-- IP列表项会通过JS动态添加 -->
                </ul>
            </div>

            <!-- 联系按钮 -->
            <div class="mt-8 animate-fadeInUp" style="animation-delay: 1.3s;">
                <button id="contact-button" 
                        class="group px-8 py-3 bg-white/10 backdrop-blur-sm border border-white/20 rounded-full 
                               text-white font-semibold hover:bg-white/20 
                               transform hover:scale-105 transition-all duration-300 relative
                               overflow-hidden">
                    <span class="relative z-10">联系我们</span>
                    <div class="absolute inset-0 bg-gradient-to-r from-white/0 via-white/5 to-white/0 
                                transform translate-x-[-100%] group-hover:translate-x-[100%] 
                                transition-transform duration-1000"></div>
                </button>
            </div>
        </div>
    </div>

    <!-- 弹出层 -->
    <div id="overlay" class="hidden fixed inset-0 bg-black/80 backdrop-blur-sm z-50 transition-opacity duration-300"></div>
    <div id="popup" class="hidden fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 
                          bg-black/70 backdrop-blur-md p-8 rounded-xl z-50 w-full max-w-md border border-white/10
                          transition-all duration-300 scale-95 opacity-0">
        <div class="space-y-4">
            <button onclick="window.location.href='mailto:DYBAGE@outlook.com'; closePopup();" 
                    class="group w-full p-3 bg-white/10 backdrop-blur-sm rounded-lg border border-white/10
                           hover:bg-white/20 transition-all duration-300 text-white relative overflow-hidden">
                <span class="relative z-10">邮箱联系我们</span>
                <div class="absolute inset-0 bg-gradient-to-r from-white/0 via-white/5 to-white/0 
                            transform translate-x-[-100%] group-hover:translate-x-[100%] 
                            transition-transform duration-1000"></div>
            </button>
            <button onclick="window.location.href='https://qm.qq.com/q/SBe2Y8J7QQ'; closePopup();" 
                    class="group w-full p-3 bg-white/10 backdrop-blur-sm rounded-lg border border-white/10
                           hover:bg-white/20 transition-all duration-300 text-white relative overflow-hidden">
                <span class="relative z-10">QQ群联系我们</span>
                <div class="absolute inset-0 bg-gradient-to-r from-white/0 via-white/5 to-white/0 
                            transform translate-x-[-100%] group-hover:translate-x-[100%] 
                            transition-transform duration-1000"></div>
            </button>
        </div>
        <button onclick="closePopup();" 
                class="absolute -top-2 -right-2 w-8 h-8 bg-black/50 backdrop-blur-sm rounded-full 
                       flex items-center justify-center border border-white/10
                       text-gray-300 hover:text-white hover:bg-black/70 transition-all duration-300">
            &times;
        </button>
    </div>

    <!-- 底部箭头 -->
    <a href="https://www.bilibili.com" 
       class="fixed bottom-8 left-1/2 transform -translate-x-1/2 w-10 h-10 
              bg-white/10 backdrop-blur-sm border border-white/20 rounded-full 
              flex items-center justify-center text-white animate-bounce
              hover:bg-white/20 transition-all duration-300">
        &#8595;
    </a>

    <script src="/static/js/time_copy.js"></script>
    <script src="/static/js/ip_display.js"></script>
    <script>
        document.getElementById('contact-button').addEventListener('click', function() {
            const overlay = document.getElementById('overlay');
            const popup = document.getElementById('popup');
            
            overlay.classList.remove('hidden');
            popup.classList.remove('hidden');
            
            setTimeout(() => {
                overlay.classList.add('opacity-100');
                popup.classList.add('scale-100', 'opacity-100');
            }, 10);
        });

        function closePopup() {
            const overlay = document.getElementById('overlay');
            const popup = document.getElementById('popup');
            
            popup.classList.remove('scale-100', 'opacity-100');
            overlay.classList.remove('opacity-100');
            
            setTimeout(() => {
                overlay.classList.add('hidden');
                popup.classList.add('hidden');
            }, 300);
        }

        async function fetchAndDisplayIPs() {
            try {
                const response = await fetch('/api/get_latest_ips');
                const data = await response.json();
                
                if (response.ok) {
                    // 显示IPv4地址
                    const ipv4List = document.getElementById('ipv4-list');
                    ipv4List.innerHTML = '';
                    (data.ipv4 || []).forEach(ip => {
                        const li = document.createElement('li');
                        li.className = 'p-2 hover:bg-white/10 rounded transition-colors duration-200 cursor-pointer';
                        li.textContent = ip;
                        li.onclick = () => {
                            navigator.clipboard.writeText(ip);
                            showToast('IP已复制到剪贴板');
                        };
                        ipv4List.appendChild(li);
                    });
                    
                    // 显示IPv6地址
                    const ipv6List = document.getElementById('ipv6-list');
                    ipv6List.innerHTML = '';
                    (data.ipv6 || []).forEach(ip => {
                        const li = document.createElement('li');
                        li.className = 'p-2 hover:bg-white/10 rounded transition-colors duration-200 cursor-pointer';
                        li.textContent = ip;
                        li.onclick = () => {
                            navigator.clipboard.writeText(ip);
                            showToast('IP已复制到剪贴板');
                        };
                        ipv6List.appendChild(li);
                    });
                    
                    // 更新修改时间
                    if (data.timestamp) {
                        document.getElementById('modification-date').textContent = 
                            `最后更新: ${data.timestamp}`;
                    }
                }
            } catch (error) {
                console.error('获取IP地址失败:', error);
                // 显示错误状态
                const ipv4List = document.getElementById('ipv4-list');
                const ipv6List = document.getElementById('ipv6-list');
                ipv4List.innerHTML = '<li class="text-red-400">获取数据失败</li>';
                ipv6List.innerHTML = '<li class="text-red-400">获取数据失败</li>';
            }
        }
    </script>
</body>

</html>